package com.example.demo517.service.impl;

import com.example.demo517.entity.Studentinfo;
import com.example.demo517.mapper.Student_Info_mapper;
import com.example.demo517.service.Student_Info_Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.example.demo517.vo.viewStudentinfo;
import java.util.List;

@Service
public class Student_Info_Service_Impl implements Student_Info_Service {
    @Autowired
    private Student_Info_mapper student_Info_mapper;
    @Override
    public PageInfo<Studentinfo> findStudentPages(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Studentinfo> studentinfoList = student_Info_mapper.getStudentInfo();
        PageInfo<Studentinfo> pageInfo = new PageInfo<>(studentinfoList);
        return pageInfo;
    }

    @Override
    public PageInfo<viewStudentinfo> findStudentInfo_clsname(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<viewStudentinfo> list = student_Info_mapper.findStudentInfo_clsname(pageNum, pageSize);
        return new PageInfo<>(list);
    }

    @Override
    public List<Studentinfo> getStudentInfo(){
        List<Studentinfo> studentinfoList = student_Info_mapper.getStudentInfo();
        return studentinfoList;
    }

    @Override
    public Studentinfo getStudentInfoByStuid(Integer id) {
        Studentinfo studentinfo = student_Info_mapper.getStudentInfoByStuid(id);
        return studentinfo;
    }

    @Override
    public int deleteStudentInfoByStuid(Integer id) {
        int relsult= student_Info_mapper.deleteStudentInfoByStuid(id) ;
        return relsult;
    }

    @Override
    public int insertStudentInfo(Studentinfo studentinfo) {
        int result = student_Info_mapper.insertStudentInfo(studentinfo);
        return result;
    }

    @Override
    public Integer updateStudentInfo(Studentinfo studentinfo) {
        int result = student_Info_mapper.updateStudentInfo(studentinfo);
        return result;
    }



}

